import 'package:flutter/material.dart';

class singleChildButton extends StatelessWidget {
  singleChildButton({
    this.flexNumber = 1,
    required this.childWidget,
    this.marginNumber = 10.0,
    required this.onPressed,
  });

  final int flexNumber;
  final Widget childWidget;
  final double marginNumber;
  final void Function() onPressed;

  @override
  Widget build(BuildContext context) {
    return Expanded(
      flex: flexNumber,
      child: GestureDetector(
        onTap: onPressed,
        child: Container(
          alignment: Alignment.center,
          decoration: BoxDecoration(
            boxShadow: [
              BoxShadow(
                color: Colors.black.withOpacity(0.2), // 阴影颜色和透明度
                spreadRadius: 2, // 阴影扩展半径
                blurRadius: 5, // 阴影模糊半径
                offset: Offset(0, 5), // 阴影偏移量
              ),
            ],
            color: Colors.white,
            borderRadius: BorderRadius.circular(25),
          ),
          margin: EdgeInsets.all(marginNumber),
          child: childWidget,
        ),
      ),
    );
  }
}
